home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Routing / auxForm-3 / AuxForm.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  5.5 KB  |  211 lines  |  [TEXT/MPS ]

  1. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  2.  
  3. constant kAppSymbol := '|AuxForm:PIEDTS|;
  4. constant kBusinessFormat := '|businessFormat:AuxForm:PIEDTS|;
  5. constant kAuxFormat := '|myAuxFormat:AuxForm:PIEDTS|;
  6. // ---- End Project Data ----
  7.  
  8. // ---- Beginning of Print templates ----
  9.  
  10. // ---- File mainFormat ----
  11.  
  12. // Before Script for "printFormat_mainFormat"
  13. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  14.  
  15. printFormat_mainFormat :=
  16.    {
  17.     printNextPageScript:
  18.       func()
  19.       begin
  20.           nil;
  21.       end,
  22.     _proto: protoPrintFormat,
  23.     debug: "printFormat_mainFormat"
  24.    };
  25.  
  26.  
  27. // Before Script for "_view000"
  28. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  29.  
  30. _view000 := /* child of printFormat_mainFormat */
  31.    {text: "Hello, world!\n",
  32.     viewBounds: {left: 0, top: 0, right: 0, bottom: 0},
  33.     viewSetupFormScript:
  34.       func()
  35.       begin
  36.          // wiggyField is set by the text from the
  37.          // auxilliary slip
  38.          self.text := if not StrEqual(fields.wiggyField, "") then
  39.                         fields.wiggyField
  40.                       else
  41.                         "Empty auxForm string" ;
  42.       end,
  43.     viewJustify: 246,
  44.     viewFont: {family: ROM_espyFont, face: 0, size: 36}
  45.     ,
  46.     _proto: protoStaticText
  47.    };
  48.  
  49.  
  50.  
  51.  
  52. // ---- End of Print templates ----
  53.  
  54. // ---- File main.t ----
  55.  
  56. // Before Script for "_view001"
  57. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  58.  
  59. _view001 :=
  60.    {title: "AuxForm",
  61.     viewBounds: {left: 0, top: 66, right: 221, bottom: 159},
  62.     target: nil,
  63.     routingFrame:
  64.       //a simple routing frame
  65.       {
  66.           // something for printing
  67.           print: {
  68.               title: "Print Thing",
  69.               routeForm: 'printSlip,
  70.               formats: [kBusinessFormat]
  71.           }
  72.       };,
  73.     viewSetupFormScript:
  74.       func()
  75.       begin
  76.          GetGlobals().routing.(kAppSymbol) := routingFrame;
  77.          targetView := self;
  78.           GetRoot().(kBusinessFormat) := BuildContext(businessFormat);
  79.       
  80.          // get my auxilliary format (auxForm), just use a proto
  81.          // to get the information
  82.          GetRoot().(kAuxFormat) := BuildContext(pt_myAuxFormat);
  83.       
  84.          // need to set target to a cursor Entry!
  85.          target := Query(GetUnionSoup("Names"), {type: 'index}):Entry() ;
  86.       end,
  87.     viewQuitScript:
  88.       func()
  89.       begin
  90.           RemoveSlot(GetGlobals().routing, kAppSymbol);
  91.           RemoveSlot(GetRoot(), kBusinessFormat);
  92.           RemoveSlot(GetRoot(), kAuxFormat);
  93.       end,
  94.     targetView: nil,
  95.     businessFormat:
  96.       {
  97.           title: "Business",
  98.           
  99.           // this is a symbol for your foramt. It is totally
  100.            // arbitrary since you jam the format into the root
  101.            // view. The only requirement is that the slot name
  102.            // in the rootView matches this symbol. What you
  103.            // jam in there is up to you. 
  104.            // see your viewSetupFormScript for the jam in.
  105.           auxForm: kAuxFormat,
  106.           
  107.            // used by mail for text only sending
  108.           textScript: nil,
  109.           attachment: true,
  110.           _proto: ROM_coverPageFormat,
  111.       
  112.           mainFormat: printFormat_mainFormat
  113.       },
  114.     setupRoutingSlip:
  115.       func(fields)
  116.       begin
  117.       //   fields.target := target ;
  118.          fields.title := "Look ma, no hands" ;
  119.       end,
  120.     _proto: protoApp
  121.    };
  122.  
  123.  
  124. // Before Script for "_view002"
  125. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  126.  
  127. _view002 := /* child of _view001 */ {_proto: protoActionButton};
  128.  
  129.  
  130.  
  131.  
  132. // ---- Beginning of non-used User Protos ----
  133.  
  134. // ---- File myAuxFormat ----
  135.  
  136. // Before Script for "mySlip"
  137. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  138.  
  139. mySlip :=
  140.    {viewBounds: {left: 4, top: 174, right: 192, bottom: 242},
  141.     viewSetupFormScript:
  142.       func()
  143.       begin
  144.          // adjust viewbounds to be right under the printslip
  145.          // (or faxslip, they both have the same bottom)
  146.          local printBounds := GetRoot().printslip.viewBounds ;
  147.          local myHeight := viewBounds.bottom - viewBounds.top ;
  148.          local newViewbounds := {} ;
  149.       
  150.          newViewBounds.left := printBounds.left ;
  151.          // add 10 to account for frame of this floater and
  152.          // the other floater (i.e., frame size is in addition
  153.          // to viewBounds.
  154.          newViewBounds.top := printBounds.bottom + 10 ;
  155.          newViewBounds.right := printBounds.right ;
  156.          newViewBounds.bottom := newViewBounds.top + myHeight + 10 ;
  157.       
  158.          self.viewBounds := newViewBounds ;
  159.       
  160.       end,
  161.     _proto: protoFloater,
  162.     debug: "mySlip"
  163.    };
  164.  
  165.  
  166. // Before Script for "_view003"
  167. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  168.  
  169. _view003 := /* child of mySlip */
  170.    {viewBounds: {left: 8, top: 24, right: 192, bottom: 56},
  171.     labelCommands: ["one", "two"],
  172.     label: "Print This:",
  173.     textChanged:
  174.       func()
  175.       begin
  176.          fields.wiggyField := text ;
  177.       end,
  178.     textSetup:
  179.       func()
  180.       begin
  181.           text := "" ;
  182.            fields.wiggyField := text ;
  183.       end,
  184.     _proto: protoLabelInputLine
  185.    };
  186.  
  187.  
  188.  
  189.  
  190. // Before Script for "explanation"
  191. // Copyright © 1993, 1994 by Apple Computer, Inc.  All rights reserved.
  192.  
  193. explanation := /* child of mySlip */
  194.    {text: "Text to print or fax",
  195.     viewBounds: {left: 0, top: 0, right: 0, bottom: 16},
  196.     viewJustify: 8388662,
  197.     _proto: protoStaticText,
  198.     debug: "explanation"
  199.    };
  200. // View explanation is declared to mySlip
  201.  
  202.  
  203.  
  204.  
  205. // ---- End of non-used User Protos ----
  206.  
  207.  
  208.  
  209. // ---- Beginning of section for non used Layout files ----
  210.  
  211. // End of output